layui.use([ 'form', 'element', 'layer' ], function() {
	var form = layui.form();
	var element = layui.element();
	var layer = layui.layer;

	// 登录按钮
	form.on('submit(login)', function(data) {
		layer.msg(JSON.stringify(data.field), {
			icon : 1,
			shade : 0.01,
			time : 1000,
			resize : false,
		});
		return false;
	});

	form.on('submit(login)', function(data) {
		layer.alert(JSON.stringify(data.field), {
			skin : 'layui-layer-molv',
			closeBtn : 0,
			icon : 2,
			shade : 0.01,
			resize : false
		});
		return false;
	});

	form.on('submit(login)', function(data) {
		window.location.href = 'upload.html';
		return false;
	});

	// 退出按钮
	form.on('submit(exit)', function(data) {
		window.location.href = "index.html";
	});

	// 左侧导航
	element.on('nav(myside)', function(elem) {
		// 新增一个Tab项
		element.tabAdd('mytab', {
			title : elem.children('a').text(),
			content : elem.children('a').data('url')
		});
	});

});